<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/base.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>新闻资讯</title>
</head>
<body>
<div id="st-container" class="st-container">
<!-- /左侧隐藏目录菜单 end -->
<jsp:include page="/WEB-INF/view/mobile/common/left_menu.jsp"/>
<!-- /左侧隐藏目录菜单 begin -->
	<div class="st-pusher">
	<div class="m-ptb54">
		<!-- /全局头部位置 header -->
		<header id="header">
			<section class="h-wrap">
				<div class="menu-btn" id="st-trigger-effects">
					<svg id="svg1" data-effect="st-effect-4" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 1024 1024" enable-background="new 0 0 32 32" xml:space="preserve">
							  <path fill="#ffffff" d="M112 572l800 0 0-48-800 0 0 48ZM112 332l800 0 0-48-800 0 0 48ZM112 76l800 0 0-48-800 0 0 48Z" transform="translate(0, 812) scale(1, -1)"/>
							</svg>
				</div>
				<!-- menu-btn -->
				<h2 class="commHeadTitle"><span>新闻资讯</span></h2>
				<!-- commHeadTitle -->
				<div class="ht-r">
					<aside class="search-icon">
						<svg x="0px" y="0px" width="26px" height="26px" viewBox="0 0 1024 1024" enable-background="new 0 0 26 26" xml:space="preserve">
								  <path fill="#ffffff" d="M439.323 24.522c-49.28 0-97.098 9.657-142.127 28.7-43.48 18.389-82.523 44.706-116.044 78.226s-59.841 72.561-78.231 116.039c-19.043 45.028-28.7 92.845-28.7 142.123 0 49.284 9.656 97.105 28.7 142.133 18.389 43.479 44.71 82.52 78.232 116.039 33.519 33.515 72.563 59.833 116.044 78.219 45.027 19.040 92.846 28.695 142.126 28.695 49.28 0 97.099-9.654 142.127-28.695 43.481-18.386 82.526-44.704 116.045-78.221 33.521-33.518 59.842-72.56 78.231-116.039 19.042-45.029 28.7-92.849 28.7-142.133 0-49.278-9.657-97.095-28.702-142.123-18.389-43.477-44.708-82.52-78.229-116.039s-72.564-59.839-116.044-78.227c-45.028-19.043-92.847-28.698-142.128-28.698zM439.323 701.483c-171.976 0-311.888-139.906-311.888-311.875s139.912-311.874 311.888-311.874 311.888 139.907 311.888 311.874-139.912 311.875-311.888 311.875zM890.678-144.735c-22.122 0-42.904 8.562-58.542 24.115l-157.464 152.645 37.039 38.206 157.888-153.059c5.607-5.607 13.092-8.693 21.078-8.693 7.983 0 15.465 3.087 21.071 8.691 5.616 5.622 8.716 13.127 8.716 21.123 0 7.981-3.092 15.463-8.703 21.068l-0.302 0.307-152.746 157.563 38.208 37.035 152.612-157.427c15.571-15.638 24.145-36.423 24.145-58.549 0-22.196-8.626-43.055-24.287-58.736-15.668-15.666-36.515-24.288-58.714-24.288zM281.015 231.245c-42.34 42.321-65.653 98.584-65.644 158.421 0.008 59.818 23.319 116.075 65.638 158.408l37.635-37.62c-66.607-66.63-66.61-175.001-0.007-241.577l-37.621-37.632z" transform="translate(0, 812) scale(1, -1)"/>
								</svg>
					</aside>
					<aside class="record-icon" onclick="window.location.href='/mobile/uc/course/study'">
						<svg x="0px" y="0px" width="32px" height="32px" viewBox="0 0 1024 1024" enable-background="new 0 0 32 32" xml:space="preserve">
								  <path fill="#ffffff" d="M512 629.333c-188.512 0-341.333-152.821-341.333-341.333s152.821-341.333 341.333-341.333c188.515 0 341.333 152.821 341.333 341.333s-152.819 341.333-341.333 341.333zM512-10.667c-164.947 0-298.667 133.717-298.667 298.667 0 164.947 133.72 298.667 298.667 298.667s298.667-133.72 298.667-298.667c0-164.949-133.72-298.667-298.667-298.667zM512.541 458.307h-42.667v-213.336h213.331v42.667h-170.664z" transform="translate(0, 812) scale(1, -1)"/>
								</svg>
					</aside>
					<div class="clear"></div>
				</div>
				<!-- /ht-r -->
			</section>

		</header>
		<!-- /header -->
		<div>
			<!-- body main -->
			<section class="animated fadeIn">
				<div>
					<div class="v-card-title-box">
						<div class="v-card-title" style="position: absolute;">
							<ul class="col-3" id="item-l-ul">
								<li <c:if test="${type==0 }">class="current"</c:if>><a href="javascript:clickSearch(0,this)" title="">全部</a></li>
								<li <c:if test="${type==1 }">class="current"</c:if>><a href="javascript:clickSearch(1,this)" title="">资讯</a></li>
								<li <c:if test="${type==2 }">class="current"</c:if>><a href="javascript:clickSearch(2,this)" title="">公告</a></li>
							</ul>
						</div>
					</div>
				</div>
				<c:if test="${articleList==null||articleList.size()==0 }">
				<!-- 无数据时提示 开始 -->
				<div class="undataBox">
					<span class="undata-icon">&nbsp;</span>
					<span>还没有相关数据，小编正在整理中...</span>
				</div>
				<!-- 无数据时提示 结束 -->
				</c:if>
				
				<div class="i-box" style="margin-bottom: -50px;">
					<div id="aCoursesList" class="news-list">
						<c:if test="${articleList!=null||articleList.size()>0 }">
						<section class="tjc-box">
							<section class="c-sort">
								<ul class="news-list-ul" id="newsContent">
									<c:forEach items="${articleList}" var="article">
									<li>
										<a href="/mobile/article/${article.id }" >
											<img xsrc="<%=staticImageServer %>${article.picture}" src="${ctximg }/static/mobile/img/sprite.gif" width="100" height="50" alt="">
											<p>${article.title}</p>
										</a>
									</li>
									</c:forEach>
								</ul>
							</section>
						</section>
						</c:if>
						<!-- 新闻公告列表 -->
					</div>

					<section>
						<section class="onload-more" style="display: none">
							<a title="加载更多..." href="javascript: void(0)">
								<img src="${ctximg }/static/mobile/img/loading.gif">
								<span>正在努力加载中...</span>
							</a>
						</section>
					</section>
				</div>

			</section>

		</div>
		<!-- 全局底部导航菜单 begin -->
		<jsp:include page="/WEB-INF/view/mobile/common/button_menu.jsp"/>
		<!-- 全局底部导航菜单 end -->
		<!-- body main -->
		<form id="searchForm" action="${ctx}/mobile/article/list" method="post">
			<input type="hidden" value="${page.totalPageSize}" id="totalPageSize"/>
			<input type="hidden" name="page.currentPage" value="${page.currentPage}" id="pageCurrentPage"/>
			<input type="hidden" id="hiddenType" name="type" value="${type}"/>
		</form>
	</div>
</div>
</div>
<script src="${ctximg }/static/mobile/js/classie.js" type="text/javascript"></script>
<script src="${ctximg }/static/mobile/js/sidebarEffects.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function() {
			posFun(); //定位上TopBar与下menuBar的位置
			gnFun(); //当前底部导航图标与字体变色
			scrollLoad(); //滚动响应加载资讯图片
			searchFun();
			$("#pageCurrentPage").val(1);
			//加载分页
			$(window).bind('scroll',function(){
				var sTop = document.documentElement.scrollTop + document.body.scrollTop;
				var sHeight = document.documentElement.scrollHeight;
				var windowHeight = $(this).height();
				//当滚动到最底下时加载数据
				if(sHeight==(sTop+windowHeight)){
					var totalPageSize=parseInt($("#totalPageSize").val());//总页数
					var nextPage=parseInt($("#pageCurrentPage").val())+1;//下一页
					$("#pageCurrentPage").val(nextPage);
					if(nextPage<=totalPageSize){
						$(".onload-more").show();
						$.ajax({
							url:'/mobile/article/ajax/list',
							data:{"type":$("#hiddenType").val(),"page.currentPage":nextPage},
							type:"post",
							dataType:"text",
							success:function(result){
								$("#newsContent").append(result);
							}
						});
						$(".onload-more").hide();
					}
					
				}
			});
		})
		function clickSearch(type,object) {
			if($(object).parent().attr("class")=='current'){
				return;
			}
	        //点击搜索时要把当前页码设置为1
	        $("#pageCurrentPage").val(1);
	    	$("#hiddenType").val(type);
	    	$("#searchForm").submit();
	    }
	</script>
</body>
</html>